<?php

namespace app\commons\model;

use think\Model;
use think\model\concern\SoftDelete;

class ActivityVideo extends Model
{
    use SoftDelete;

    protected $deleteTime = 'delete_time';

//    public $autoWriteTimestamp = true;
    /**
     * 返回完整路径
     * @param $value
     * @return string
     */
    public function getPathAttr($value){
        return $value;//images_url($value);
    }

    /**
     * 关联活动
     */
    public function sale(){
        return $this->hasOne(Sale::class,'id','sale_id')->field(['title','id','status']);
    }

    /**
     * 关联用户
     */
    public function member(){
        return $this->hasOne(Member::class,'id','user_id')->field(['nickname','id','avatar']);
    }
}